/*
 * @(#)SimulationServer.java	Robert Denda&Didier Gutacker
 */

/** 
 *
 * @author 	Robert Denda&Didier Gutacker
 * @version     1.1, 06.09.97
 * @see Server
 * @see SimServerRIP
 * @see SimServerDVMRP
 * @see SimulationFrame
 * @see Simulation
 */

import java.awt.*;

public abstract class SimulationServer extends Server implements Simulation, Runnable {
  
  public TextMethods text;

  public ThreadGroup tg;
  public SimulationFrame f;

  public Lock textChangeGuard;

  public static Image routerImage;

  public SimulationServer(int port)
  {
    super(port);
    tg = serverThread.getThreadGroup();
    routerImage = Toolkit.getDefaultToolkit().getImage( "router.gif" );
    textChangeGuard = new Lock();
  }

  public static void main( String [] argv ) {
  } // SimulationServer.main

  public ThreadGroup getThreadGroup() {
    return tg;
  } // SimulationServer.getThreadGroup

  public void setText( TextMethods text ) {
    textChangeGuard.acquire();
    this.text = text;
    text.frameTitle = text.frameTitle + " <SERVER>";
    textChangeGuard.release();
    f.repaint();
  } // SimulationServer.setText

  public TextMethods getText() {
    textChangeGuard.acquire();
    TextMethods returnValue = text;
    textChangeGuard.release();
    return returnValue;
  } // SimulationServer.getText

  public Image getRouterImage() {
    return routerImage;
  } // SimulationServer.getRouterImage

} // SimulationServer
